<script setup>
const $get = inject('$get');

const total = ref(0);
const search = reactive({
    pageNum: 1,
    pageSize: 30,
});

const dataList = ref([]);

function getList() {
    $get('/human/orders/listByEnterprise', search).then(res => {
        total.value = res.total;
        dataList.value = res.rows;
    });
}
getList();
</script>

<template>
    <div class="human-order">
        <wd-table :data="dataList" height="80vh" stripe>
            <wd-table-col prop="orderNo" label="订单号" align="center" width="150px"></wd-table-col>
            <wd-table-col prop="packages.name" label="套餐名称" align="center">
                <template #value="{ row }">{{ row.packages.name }}</template>
            </wd-table-col>
            <wd-table-col prop="updateBy" label="支付人" align="center"></wd-table-col>
            <wd-table-col prop="state" label="支付状态" align="center" width="150px">
                <template #value="{ row }">
                    <text v-if="row.status == 0" type="warning">{{ '待支付' }}</text>
                    <text v-if="row.status == 1" type="success">{{ '已支付' }}</text>
                    <text v-if="row.status == 2" type="danger">{{ '已取消' }}</text>
                    <text v-if="row.status == 3" type="warning">{{ '已过期' }}</text>
                </template>
            </wd-table-col>
            <wd-table-col prop="amount" label="支付金额" align="center"></wd-table-col>
            <wd-table-col prop="createTime" label="购买时间" align="center"></wd-table-col>
            <wd-table-col prop="duration" label="套餐时长" align="center">
                <template #value="{ row }">{{ row.packages.durationDays }}天</template>
            </wd-table-col>
        </wd-table>
        <wd-pagination
            custom-style="border: 1px solid #ececec;border-top:none"
            v-model="search.pageNum"
            :page-size="search.pageSize"
            :total="total"
            @change="getList"
        ></wd-pagination>
    </div>
</template>

<style scoped lang="scss"></style>
